
module Cms
  class Browser < Fragment

    state_defined_by :draggable => false

    attr_accessor :items

    def initialize
      super()
      @items = []
    end

    def render
      items.each do |item|
        if item.object.respond_to? :get_icon
          icon = item.object.get_icon
        else
          icon = Icon.new
          icon.label = item.class.to_s
          icon.uuid = item.uuid
        end
        icon.uuid ||= item.uuid
        add icon
      end
      super()
    end

  end
end
